
<div class="container-fluid">
    <div class="panel panel-default">
        <!-- Default panel contents -->
        <div class="panel-body ">
            <div class="row">
                <div id="Game">
                    <form name="newForm" id="newForm" action="op.php?op=member&fp=proc29" target="leftFrame" onSubmit="javascript:return chkForm(this);" method="post">
                        <div id="showTable">
                            <!--连码类别-->
                            <div class="round-table2" id="round-table" style="margin-left: 10px;">
                                <table id="table1" class="table table-bordered" style="bakcground-color:white;" class="MobileTable">
                                    <tbody>
                                    <tr class="title_tr">
                                        <td> 类别 </td>
                                        <td><label class="padding_label">
                                                <input type="radio" name="type" value="29" onClick="page_b='10-'+this.value;ctrlBetType(this.value);RefRate()" checked>
                                                五不中 </label></td>
                                        <td><label class="padding_label">
                                                <input type="radio" name="type" value="39" onClick="page_b='10-'+this.value;ctrlBetType(this.value);RefRate()">
                                                六不中 </label></td>
                                        <td><label class="padding_label">
                                                <input type="radio" name="type" value="40" onClick="page_b='10-'+this.value;ctrlBetType(this.value);RefRate()">
                                                七不中 </label></td>
                                        <td><label class="padding_label">
                                                <input type="radio" name="type" value="41" onClick="page_b='10-'+this.value;ctrlBetType(this.value);RefRate()">
                                                八不中 </label></td>
                                        <td><label class="padding_label">
                                                <input type="radio" name="type" value="42" onClick="page_b='10-'+this.value;ctrlBetType(this.value);RefRate()">
                                                九不中 </label></td>
                                        <td><label class="padding_label">
                                                <input type="radio" name="type" value="43" onClick="page_b='10-'+this.value;ctrlBetType(this.value);RefRate()">
                                                十不中 </label></td>
                                        <td><label class="padding_label">
                                                <input type="radio" name="type" value="44" onClick="page_b='10-'+this.value;ctrlBetType(this.value);RefRate()">
                                                十一不中 </label></td>
                                        <td><label class="padding_label">
                                                <input type="radio" name="type" value="45" onClick="page_b='10-'+this.value;ctrlBetType(this.value);RefRate()">
                                                十二不中 </label></td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                            <!--连码table-->
                            <div class="round-table2" id="round-table" style="margin-left: 10px;">
                                <table id="numBlock" class="table table-bordered" style="text-align:center;" class="MobileTable">
                                    <tbody>
                                    <tr class="title_tr">
                                        <td width="50"> 号码 </td>
                                        <td width="50"> 赔率 </td>
                                        <td width="46"> 勾选 </td>
                                        <td width="50"> 号码 </td>
                                        <td width="50"> 赔率 </td>
                                        <td width="46"> 勾选 </td>
                                        <td width="50"> 号码 </td>
                                        <td width="50"> 赔率 </td>
                                        <td width="46"> 勾选 </td>
                                        <td width="50"> 号码 </td>
                                        <td width="50"> 赔率 </td>
                                        <td width="46"> 勾选 </td>
                                        <td width="50"> 号码 </td>
                                        <td width="50"> 赔率 </td>
                                        <td width="46"> 勾选 </td>
                                    </tr>
                                    <tr>
                                        <td class="bColorR"><span>01</span></td>
                                        <td><span class="rate" id="r29_1">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[1]" value="1"></td>
                                        <td class="bColorG"><span>11</span></td>
                                        <td><span class="rate" id="r29_11">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[11]" value="11"></td>
                                        <td class="bColorG"><span>21</span></td>
                                        <td><span class="rate" id="r29_21">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[21]" value="21"></td>
                                        <td class="bColorB"><span>31</span></td>
                                        <td><span class="rate" id="r29_31">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[31]" value="31"></td>
                                        <td class="bColorB"><span>41</span></td>
                                        <td><span class="rate" id="r29_41">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[41]" value="41"></td>
                                    </tr>
                                    <tr>
                                        <td class="bColorR"><span>02</span></td>
                                        <td><span class="rate" id="r29_2">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[2]" value="2"></td>
                                        <td class="bColorR"><span>12</span></td>
                                        <td><span class="rate" id="r29_12">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[12]" value="12"></td>
                                        <td class="bColorG"><span>22</span></td>
                                        <td><span class="rate" id="r29_22">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[22]" value="22"></td>
                                        <td class="bColorG"><span>32</span></td>
                                        <td><span class="rate" id="r29_32">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[32]" value="32"></td>
                                        <td class="bColorB"><span>42</span></td>
                                        <td><span class="rate" id="r29_42">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[42]" value="42"></td>
                                    </tr>
                                    <tr>
                                        <td class="bColorB"><span>03</span></td>
                                        <td><span class="rate" id="r29_3">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[3]" value="3"></td>
                                        <td class="bColorR"><span>13</span></td>
                                        <td><span class="rate" id="r29_13">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[13]" value="13"></td>
                                        <td class="bColorR"><span>23</span></td>
                                        <td><span class="rate" id="r29_23">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[23]" value="23"></td>
                                        <td class="bColorG"><span>33</span></td>
                                        <td><span class="rate" id="r29_33">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[33]" value="33"></td>
                                        <td class="bColorG"><span>43</span></td>
                                        <td><span class="rate" id="r29_43">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[43]" value="43"></td>
                                    </tr>
                                    <tr>
                                        <td class="bColorB"><span>04</span></td>
                                        <td><span class="rate" id="r29_4">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[4]" value="4"></td>
                                        <td class="bColorB"><span>14</span></td>
                                        <td><span class="rate" id="r29_14">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[14]" value="14"></td>
                                        <td class="bColorR"><span>24</span></td>
                                        <td><span class="rate" id="r29_24">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[24]" value="24"></td>
                                        <td class="bColorR"><span>34</span></td>
                                        <td><span class="rate" id="r29_34">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[34]" value="34"></td>
                                        <td class="bColorG"><span>44</span></td>
                                        <td><span class="rate" id="r29_44">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[44]" value="44"></td>
                                    </tr>
                                    <tr>
                                        <td class="bColorG"><span>05</span></td>
                                        <td><span class="rate" id="r29_5">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[5]" value="5"></td>
                                        <td class="bColorB"><span>15</span></td>
                                        <td><span class="rate" id="r29_15">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[15]" value="15"></td>
                                        <td class="bColorB"><span>25</span></td>
                                        <td><span class="rate" id="r29_25">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[25]" value="25"></td>
                                        <td class="bColorR"><span>35</span></td>
                                        <td><span class="rate" id="r29_35">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[35]" value="35"></td>
                                        <td class="bColorR"><span>45</span></td>
                                        <td><span class="rate" id="r29_45">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[45]" value="45"></td>
                                    </tr>
                                    <tr>
                                        <td class="bColorG"><span>06</span></td>
                                        <td><span class="rate" id="r29_6">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[6]" value="6"></td>
                                        <td class="bColorG"><span>16</span></td>
                                        <td><span class="rate" id="r29_16">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[16]" value="16"></td>
                                        <td class="bColorB"><span>26</span></td>
                                        <td><span class="rate" id="r29_26">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[26]" value="26"></td>
                                        <td class="bColorB"><span>36</span></td>
                                        <td><span class="rate" id="r29_36">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[36]" value="36"></td>
                                        <td class="bColorR"><span>46</span></td>
                                        <td><span class="rate" id="r29_46">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[46]" value="46"></td>
                                    </tr>
                                    <tr>
                                        <td class="bColorR"><span>07</span></td>
                                        <td><span class="rate" id="r29_7">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[7]" value="7"></td>
                                        <td class="bColorG"><span>17</span></td>
                                        <td><span class="rate" id="r29_17">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[17]" value="17"></td>
                                        <td class="bColorG"><span>27</span></td>
                                        <td><span class="rate" id="r29_27">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[27]" value="27"></td>
                                        <td class="bColorB"><span>37</span></td>
                                        <td><span class="rate" id="r29_37">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[37]" value="37"></td>
                                        <td class="bColorB"><span>47</span></td>
                                        <td><span class="rate" id="r29_47">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[47]" value="47"></td>
                                    </tr>
                                    <tr>
                                        <td class="bColorR"><span>08</span></td>
                                        <td><span class="rate" id="r29_8">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[8]" value="8"></td>
                                        <td class="bColorR"><span>18</span></td>
                                        <td><span class="rate" id="r29_18">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[18]" value="18"></td>
                                        <td class="bColorG"><span>28</span></td>
                                        <td><span class="rate" id="r29_28">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[28]" value="28"></td>
                                        <td class="bColorG"><span>38</span></td>
                                        <td><span class="rate" id="r29_38">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[38]" value="38"></td>
                                        <td class="bColorB"><span>48</span></td>
                                        <td><span class="rate" id="r29_48">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[48]" value="48"></td>
                                    </tr>
                                    <tr>
                                        <td class="bColorB"><span>09</span></td>
                                        <td><span class="rate" id="r29_9">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[9]" value="9"></td>
                                        <td class="bColorR"><span>19</span></td>
                                        <td><span class="rate" id="r29_19">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[19]" value="19"></td>
                                        <td class="bColorR"><span>29</span></td>
                                        <td><span class="rate" id="r29_29">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[29]" value="29"></td>
                                        <td class="bColorG"><span>39</span></td>
                                        <td><span class="rate" id="r29_39">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[39]" value="39"></td>
                                        <td class="bColorG"><span>49</span></td>
                                        <td><span class="rate" id="r29_49">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[49]" value="49"></td>
                                    </tr>
                                    <tr>
                                        <td class="bColorB"><span>10</span></td>
                                        <td><span class="rate" id="r29_10">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[10]" value="10"></td>
                                        <td class="bColorB"><span>20</span></td>
                                        <td><span class="rate" id="r29_20">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[20]" value="20"></td>
                                        <td class="bColorR"><span>30</span></td>
                                        <td><span class="rate" id="r29_30">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[30]" value="30"></td>
                                        <td class="bColorR"><span>40</span></td>
                                        <td><span class="rate" id="r29_40">0</span></td>
                                        <td><input name="ballNum" type="checkbox" onClick="javascript:ctrlNum(this);" id="ballNum[40]" value="40"></td>
                                        <td colspan="3" class="Send"></td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                        <table width="730" height="45" style="margin:5px" border="0" cellpadding="0" cellspacing="0">
                            <tr>
                                <td colspan="2">选择：<span style="color:#000000;font-size:11pt;" id="betStatus"></span> <span style="color:#000000;font-size:11pt;" id="betUnionBlock"></span></td>
                            </tr>
                            <tr>
                                <td width="430" height="45" align="left"><font color='red'>※ 请先选择类别，自选不中只能以连碰方式下注！<br>※ 赔率以选中的号码最低赔率为参考赔率，请以注单存档之後的赔率为准!!</font></td>
                                <td width="300" height="45" align="right"><span style="font-size:14px; ">
        <input class="yes btn btn-success" type="submit" style="height:25px; width:40px; padding: 0 0;" name="btnBet" value="确定">
        &nbsp;  &nbsp;
        <input type="button" class="btn btn-default" value="清除" style="height:25px; width:40px; padding: 0 0;" onClick="javascript:clearForm();">
        &nbsp;  &nbsp;
        <input type=button name=cancel value="重选" class="btn btn-default" style="height:25px; width:40px; padding: 0 0;" onClick="location.replace('op.php?op=member&fp=bet29')"></td>
                            </tr>
                        </table>
                </div>
                </form>
                 </div>
            </div>
        </div>
    </div>
</div>

<script>
var page_b="10-29";
var TwelveAnimalSeed = {cchinayear};
var now = new Date(1000 * {phptime});
var timestap = {timestap};
var g_refresh_delay = 30000;
var gametype=0;
var currentBetType = 29; //目前的下注类别
var theMaxNum = 5;       //最大组合数 5~12
var chosenNum = [];      //已选择的号码
if(window.ActiveXObject)
{
	var xh =  new ActiveXObject("Microsoft.XMLHTTP");
}else{
	var xh =  new XMLHttpRequest();
}
function d2(v)
{
	return (v<=9?'0':'')+v;	
}
var M = new Object();
M.charset = "big5";
M.Rates = new Array();
M.Rates[29] = new Array();  //五不中=29
for (i=0; i<49; i++) { M.Rates[29][i+1] = 0; }
for (j=39; j<=45; j++) {
  M.Rates[j] = new Array();    //6~12 =39!45
  for (i=0; i<49; i++) { M.Rates[j][i+1] = 0; }
}

//第一次执行一次
var choice_disk = 29;
showBetRate(choice_disk);


//选择下注玩法 5~12 不中
function ctrlBetType(ctrlVal){
    choice_disk = ctrlVal;
    ctrlVal = parseInt(ctrlVal);
    showBetRate(ctrlVal)
    currentBetType = ctrlVal;//目前的下注类别
  	theMaxNum=0;
  	switch(currentBetType){
      case 29: theMaxNum=5;break; 
      case 39: theMaxNum=6;break; 
      case 40: theMaxNum=7;break; 
      case 41: theMaxNum=8;break; 
      case 42: theMaxNum=9;break; 
      case 43: theMaxNum=10;break; 
      case 44: theMaxNum=11;break; 
      case 45: theMaxNum=12;break; 
    }    
    clearForm();//清除纪录重来
}

//取得赔率值
function GetBet(currentBetType)
{
  var disk = document.getElementById("select_disk").value;
	xh.open("POST", "xml.php?b="+currentBetType+"-1&disk="+disk,false);
	xh.setRequestHeader("Content-Type","text/xml;charset="+M.Charset);
	try {
		xh.send("");
		return (xh.responseText);
	} catch (e) {
		alert(e);
	}
}
//显示赔率值
function showBetRate(currentBetType)
{
  window.status = "更新赔率中......";
	var s = GetBet(choice_disk);
	if (s=="") {
		window.status = "";
		return;
	}
	var ary = s.split(",");
	if (ary[0]=="1") {
		//显示赔率值
		for (var i=1; i<=49; i++) {
		  var obj = eval("r"+i);
		  obj.innerHTML = ary[i];
		}
	}
	window.status = "";
	//setTimeout("showBetRate("+currentBetType+")", g_refresh_delay);
}

//清除纪录
function clearRecord(){
    chosenNum = [];//已选择的号码，如果是胆托则只存非胆拖的值
    clearBetUnionValue();//清除组合隐藏栏位值
    document.getElementById("betStatus").innerHTML = "";;//清除下注状态讯息
}

//号码
function ctrlNum(ctrl){
    var ctrlValue = parseInt(ctrl.value);
    if(ctrl.checked == true){//选取
        chosenNum.push(ctrlValue);//新增
    }else{//选消
        chosenNum = _arrayRemove(chosenNum, ctrlValue);
    }
    chosenNum = _arraySort(chosenNum);//已选择的号码重新排列
    computeUnion();//计算组合
}
//阵列排序
function _arraySort(sortArray){
    arrayLength = sortArray.length;
    for (var i = 0; i < arrayLength; i++) {
        var arrayValue = sortArray[i];
        for (var j = i - 1; ( (j >= 0) && (sortArray[j] > arrayValue) ); j--) {
            sortArray[j + 1] = sortArray[j];
        }
        sortArray[j + 1] = arrayValue;
    }
    return sortArray;
}

//阵列remove
function _arrayRemove(removeArray, removeKey){
    var tmpArray = new Array();
    for(var i=0; i < removeArray.length; i ++){
        if(removeArray[i] != removeKey){
            tmpArray.push(removeArray[i]);
        }
    }
    return tmpArray;
}
/**产生组合***************************************/
//计算组合
function computeUnion(){
      betUnion = chosenNum;//下注组合取值
			if (chosenNum.length == theMaxNum)
			   _disUnchk(true); // 若勾了1组，就不可再勾
      else
        _disUnchk(false); // 若未满1组，就可再勾

      createBetUnionValue(betUnion, 1, false);//写入隐藏栏位
      //显示状态
      var statusMessage = "[" + betUnion.join(",") + "]，已勾选 "+ chosenNum.length +" 号";
      document.getElementById("betStatus").innerHTML = statusMessage;
}
//送出前检查表单
function chkForm(frm){
  //检查下注栏位
	if(chosenNum < 1){
		alert('号码未选择');
		return false;
	}

	if(chosenNum.length != theMaxNum){
			alert('自选不中号码数错误');
			return false;
	}
  /* /检查注金栏位
  if(currentOneBetMoney < 1){
      alert('金额未输入');
      return false;
  }
  */
  frm.submit();
}
// -----------------------------------------------------------------------------
// 是否把 未打勾的 checkbox 设为 disabled
// @param boolean bDis : true 把未勾选的设disabled, false 把全部设为可勾选  
// -----------------------------------------------------------------------------
function _disUnchk(bDis){
  var oChkStr = "";
  var oChk = "";
  if(bDis == false){
    for(var i=1; i < 50; i++){
      oChkStr = "ballNum[" + i + "]";
      document.getElementById(oChkStr).disabled = false;
    }
  }else{
    for(var i=1; i < 50; i++){
      oChkStr = "ballNum[" + i + "]";
      if(document.getElementById(oChkStr).checked == false){
        document.getElementById(oChkStr).disabled = true;
      }else{
        document.getElementById(oChkStr).disabled = false;
      }
    }
  }
}
//赋予组合隐藏栏位值
function createBetUnionValue(valueArray, betNum, isMultiDimen){
    var targetBlock = document.getElementById("betUnionBlock");
    //先清空
    clearBetUnionValue();
    //开始写入组合
    betNum = 1;
    var hiddenItem = document.createElement("input");
    hiddenItem.setAttribute("id", 'num1');
    hiddenItem.setAttribute("name", 'num1');
    hiddenItem.setAttribute("type","hidden");
    hiddenItem.setAttribute("value", valueArray.join(","));
    targetBlock.appendChild(hiddenItem);
}
//清除表单
function clearForm(){
    //依目前所处状态清除内容，包含下注金额也须删除
    clearChecked('ballNum');
    // document.getElementById("money").value = "";
    clearRecord();
}
//清除 checked group
function clearChecked(groupName){
    var targetGroup = document.forms["newForm"][groupName];
    for (var i = 0; i < targetGroup.length; i++){
        if (targetGroup[i].checked == true){
            targetGroup[i].checked = false;
        }
        if (targetGroup[i].disabled == true){
            targetGroup[i].disabled = false;
        }
    }
}
//清除组合隐藏栏位值
function clearBetUnionValue(){
    var targetBlock = document.getElementById("betUnionBlock");
    targetBlock.innerHTML ='';
}
</script>
<script src="js/6h.js" type="text/jscript"></script>